<?php
$start = gettimeofday(true);
$memory = memory_get_usage(true);

error_reporting(E_ALL|E_STRICT);
ini_set('display_startup_errors', true);
ini_set('display_errors', true);

// Define path to html directory
defined('DOCUMENT_PATH')
    || define('DOCUMENT_PATH', realpath(dirname(__FILE__)));

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(DOCUMENT_PATH . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH . '/modules'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

/** Phorm_Application_Config */
require_once 'Phorm/Application/Config.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    //APPLICATION_PATH . '/configs/application.xml'
    Phorm_Application_Config::load(APPLICATION_PATH . '/configs/application/', APPLICATION_ENV)
);
$application->bootstrap()
            ->run();
            

//print gettimeofday(true)-$start;
//print number_format((memory_get_usage(true)-$memory)/1024,0,'.',' ') . ' Kb';
